/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package servlet;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;

/**
 *
 * @author Administrador
 */
public class UtilWeb {

    public static void incluir(HttpServletRequest request, HttpServletResponse response, String ruta) throws JspException {
        try {
            request.getServletContext().getRequestDispatcher(ruta).
                    include(request, response);
        } catch (Throwable ex) {
            Logger.getLogger(UtilWeb.class.getName()).log(Level.SEVERE, "Error en UtilWeb.incluir", ex);
            throw new JspException(ex);
        }
    }
    public static void forward(HttpServletRequest request, HttpServletResponse response, String ruta) throws JspException {
        try {
            request.getServletContext().getRequestDispatcher(ruta).
                    forward(request, response);
        } catch (Throwable ex) {
            Logger.getLogger(UtilWeb.class.getName()).log(Level.SEVERE, "Error en UtilWeb.incluir", ex);
            throw new JspException(ex);
        }
    }    
}
